<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>注册赚钱</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" href="css/list.css" />
		<script src="js/jquery-3.3.1.min.js"></script>
		<script src="js/toast.js"></script>

		<script src="js/config.js"></script>
		<style type="text/css">
			.mui-content>.mui-table-view:first-child {
				margin-top: -1px;
			}
			
			.mui-content {
				padding: 0;
				margin: 0;
			}
			
			@keyframes fadeIn {
				0% {
					opacity: 0
				}
				100% {
					opacity: 1
				}
			}
			
			@-webkit-keyframes fadeIn {
				0% {
					opacity: 0
				}
				100% {
					opacity: 1
				}
			}
			
			@-moz-keyframes fadeIn {
				0% {
					opacity: 0
				}
				100% {
					opacity: 1
				}
			}
			
			@-o-keyframes fadeIn {
				0% {
					opacity: 0
				}
				100% {
					opacity: 1
				}
			}
			
			@-ms-keyframes fadeIn {
				0% {
					opacity: 0
				}
				100% {
					opacity: 1
				}
			}
			
			@keyframes fadeOut {
				0% {
					opacity: 1
				}
				100% {
					opacity: 0
				}
			}

			@-webkit-keyframes fadeOut {
				0% {
					opacity: 1
				}
				100% {
					opacity: 0
				}
			}
			
			@-moz-keyframes fadeOut {
				0% {
					opacity: 1
				}
				100% {
					opacity: 0
				}
			}
			
			@-o-keyframes fadeOut {
				0% {
					opacity: 1
				}
				100% {
					opacity: 0
				}
			}
			
			@-ms-keyframes fadeOut {
				0% {
					opacity: 1
				}
				100% {
					opacity: 0
				}
			}
			
			#toast {
				width: 150px;
				height: 150px;
				text-align: center;
				background: rgba(0, 0, 0, 0.7);
				color: #fff;
				font-size: 18px;
				line-height: 150px;
				padding: 10px;
				border-radius: 3px;
				position: fixed;
				left: 0;
				top: 0;
				right:0;
				bottom:0;
				margin:auto;
				z-index: 9999;
			}
			
			.hide {
				display: none;
			}
			
			.fadeOut {
				animation: fadeOut .5s;
			}
			
			.fadeIn {
				animation: fadeIn .5s;
			}
		</style>
	</head>

	<body>
		<!--<header class="mui-bar mui-bar-nav">-->
			<!--<h3 class="mui-title">大钞市·注册赚钱</h3>-->
		<!--</header>-->

		<div class="head">
			<div class="left">
				<div class="back">
					<a href="./index.html" class="back mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>

				</div>
			</div>

			<div class="right">
				<h4>注册赚钱</h4>
				<p>①领取任务 ②按要求完成任务并提交③审核通过领现金</p>
				<p class="title-small">一次只能领取一个任务，完成或放弃后才可抢其他任务</p>

			</div>

		</div>

		<div class="content">
			<!--下拉刷新容器-->
			<div id="pullrefresh" class="mui-content">
				<!--数据列表-->
				<ul class="mui-table-view mui-table-view-chevron">
					<!--审核中-->
					<div class="top1">
						<div class="shenhe">审核中</div>
						<ul class="shenheUl">


						</ul>

					</div>
					<!--进行中-->
					<div class="top">
						<div class="jinxing">进行中</div>
						<ul class="jinxingUl">


						</ul>
						
					</div>
					
					

					<!--投放中-->
					<div class="down">
						<div class="toufang">投放中</div>
						<ul class="toufangUl">

						
							
						</ul>
						
						
						
					</div>
					

				</ul>
			</div>

		</div>

		
		<script>
			$(function() {

				init();

			})





			function toContent(a) {
				// 调用
                toast("拼命争抢任务中",1000);

				setTimeout(function() {
					console.log('111111'+a)
					 $.ajax({
								  type: 'POST',
								  url: host+"/buss/task/log/start",
								  data: {taskId:a},
								  success: function(res){
								  	console.log("222222"+JSON.stringify(res))
								  	console.log("开始任务");
                                      if(res.success){
                                          toast(res.msg,1000);
                                          window.location.href = "./content.html?i=" + a;
                                      }else{
                                          toast(res.msg,1000);
                                      }
								  	
								  	
								  },
								  error:function(err){
								  	console.log(err)
								  	
								  }
							 });
				
					
				},1500)

			}

            function toContenting(a) {

                window.location.href = "./content.html?i=" + a;

            }


			var taskId="";
			function init() {
				
				
				//投放中的任务
				$.ajax({
					url: host + "/buss/task/page",
					type: "get",
                    cache:false,
					success: function(res) {
						console.log(JSON.stringify(res))
						
						if(res.success) {
							var conment = "";
							var conment2 = "";
							var conment3 = "";
							console.log(res.data.length+"投放中的任务的")
							for(let i = 0; i < res.data.length; i++) {
								taskId =res.data[i].id;
								var name = res.data[i].name;
								var money = res.data[i].userPrice;
								var path = res.data[i].imgIcon;
								var data = res.data;
								var status = res.data[i].taskStatus;
								var shenheStatus = res.data[i].shenheStatus;
								var tedian = res.data[i].surpNum
							console.log(status)
								//进行中的任务
								if(status){
									$(".top").eq(0).css("display", "block");
									conment += '<li class="list" onclick="toContenting(\'' + taskId + '\')"><div class="img">' +
										'<img src=' + path + ' alt="" />' +
										'<div class="desc">'+
										'<div class="text">' + name + '</div>' +							
										'</div>' +
										'</div>' +
										'<div class="money">' + '进行中' + '</div></li>';
								}
							
								if(!status && shenheStatus!=1) {
									conment2 += '<li class="list" onclick="toContent(\'' + taskId + '\')"><div class="img">' +
										'<img src=' + path + ' alt="" />' +
										'<div class="desc">'+
										'<div class="text">' + name + '</div>' +
										'<div class="tedian">'+
										'<span>'+ tedian +'</span>'+
										'</div>' +
										'</div>'+								
										'</div>' +
										'<div class="money">' + '<span class="plus">' + '+' + '</span>' + '<span class="red">' + money + '</span>' + '元' + '</div></li>';
								}

                                if(shenheStatus==1) {
                                    $(".top1").eq(0).css("display", "block");
                                    conment3 += '<li class="list" onclick="toAlert()"><div class="img">' +
                                        '<img src=' + path + ' alt="" />' +
                                        '<div class="desc">'+
                                        '<div class="text">' + name + '</div>' +
                                        '</div>' +
                                        '</div>' +
                                        '<div class="money">' + '审核中' + '</div></li>';
                                }

							}

						document.getElementsByClassName("jinxingUl")[0].innerHTML=conment;
						document.getElementsByClassName("toufangUl")[0].innerHTML=conment2;
						document.getElementsByClassName("shenheUl")[0].innerHTML=conment3;


						}

					},
					error: function(err) {
						console.log("获取投放中任务列表失败");

					}
				});

			}


		//	点击审核中的任务

			function toAlert(){
                toast("您的审核已提交",1500);
			}
		</script>
	</body>

</html>